package com.icss.daos;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.icss.beans.LogVO;

public class LogDao {

	Dao dao=null;
	public void insertWorkLog(String sql){
		dao=new Dao();
		boolean flag=dao.execute(sql);
		if(flag==true){
			System.out.println("日志添加成功！");
			
		}else{System.out.println("添加日志操作失败！");}	
		
	}
	
	
	//查询工作日志
	public List<LogVO> selectWorkLog(String sql){
		List<LogVO> list=new ArrayList<LogVO>();
		dao=new Dao();
		ResultSet rs=dao.query(sql);
		try {
			while(rs.next()){
				LogVO vo=new LogVO();
				vo.setLogType(rs.getString("logType"));
				vo.setLogDate(rs.getDate("logDate"));
				vo.setLogTitle(rs.getString("logTitle"));
				vo.setLogContent(rs.getString("logContent"));
				list.add(vo);
				System.out.println("查询日志结果不为空！");
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}
	
	
	
	
	
	
	
	
	
	
	
	
}
